<?php
	/**
	 * This is a MetaControl class, providing a QForm or QPanel access to event handlers
	 * and QControls to perform the Create, Edit, and Delete functionality
	 * of the User class.  This code-generated class
	 * contains all the basic elements to help a QPanel or QForm display an HTML form that can
	 * manipulate a single User object.
	 *
	 * To take advantage of some (or all) of these control objects, you
	 * must create a new QForm or QPanel which instantiates a UserMetaControl
	 * class.
	 *
	 * Any and all changes to this file will be overwritten with any subsequent
	 * code re-generation.
	 *
	 * @package flx_qcubed
	 * @subpackage MetaControls
	 * @property-read User $User the actual User data class being edited
	 * @property QLabel $IdControl
	 * @property-read QLabel $IdLabel
	 * @property QTextBox $FirstNameControl
	 * @property-read QLabel $FirstNameLabel
	 * @property QTextBox $LastNameControl
	 * @property-read QLabel $LastNameLabel
	 * @property QTextBox $PhoneControl
	 * @property-read QLabel $PhoneLabel
	 * @property QTextBox $MobileControl
	 * @property-read QLabel $MobileLabel
	 * @property QTextBox $EmailControl
	 * @property-read QLabel $EmailLabel
	 * @property QCheckBox $IsEnableControl
	 * @property-read QLabel $IsEnableLabel
	 * @property QCheckBox $IsAdminControl
	 * @property-read QLabel $IsAdminLabel
	 * @property QTextBox $UsernameControl
	 * @property-read QLabel $UsernameLabel
	 * @property QTextBox $PasswordControl
	 * @property-read QLabel $PasswordLabel
	 * @property QTextBox $LogUserControl
	 * @property-read QLabel $LogUserLabel
	 * @property QDateTimePicker $LogInsertControl
	 * @property-read QLabel $LogInsertLabel
	 * @property QLabel $LogUpdateControl
	 * @property-read QLabel $LogUpdateLabel
	 * @property-read string $TitleVerb a verb indicating whether or not this is being edited or created
	 * @property-read boolean $EditMode a boolean indicating whether or not this is being edited or created
	 */

	class UserMetaControlGen extends QBaseClass {
		// General Variables
		/**
		 * @var User objUser
		 * @access protected
		 */
		protected $objUser;
		/**
		 * @var QForm|QControl objParentObject
		 * @access protected
		 */
		protected $objParentObject;
		/**
		 * @var string strTitleVerb
		 * @access protected
		 */
		protected $strTitleVerb;
		/**
		 * @var boolean blnEditMode
		 * @access protected
		 */
		protected $blnEditMode;

		// Controls that allow the editing of User's individual data fields
		/**
		 * @var QLabel lblId
		 * @access protected
		 */
		protected $lblId;
		/**
		 * @var QTextBox txtFirstName
		 * @access protected
		 */
		protected $txtFirstName;
		/**
		 * @var QTextBox txtLastName
		 * @access protected
		 */
		protected $txtLastName;
		/**
		 * @var QTextBox txtPhone
		 * @access protected
		 */
		protected $txtPhone;
		/**
		 * @var QTextBox txtMobile
		 * @access protected
		 */
		protected $txtMobile;
		/**
		 * @var QTextBox txtEmail
		 * @access protected
		 */
		protected $txtEmail;
		/**
		 * @var QCheckBox chkIsEnable
		 * @access protected
		 */
		protected $chkIsEnable;
		/**
		 * @var QCheckBox chkIsAdmin
		 * @access protected
		 */
		protected $chkIsAdmin;
		/**
		 * @var QTextBox txtUsername
		 * @access protected
		 */
		protected $txtUsername;
		/**
		 * @var QTextBox txtPassword
		 * @access protected
		 */
		protected $txtPassword;
		/**
		 * @var QTextBox txtLogUser
		 * @access protected
		 */
		protected $txtLogUser;
		/**
		 * @var QDateTimePicker calLogInsert
		 * @access protected
		 */
		protected $calLogInsert;
		/**
		 * @var QLabel lblLogUpdate
		 * @access protected
		 */
		protected $lblLogUpdate;

		// Controls that allow the viewing of User's individual data fields
		/**
		 * @var QLabel lblFirstName
		 * @access protected
		 */
		protected $lblFirstName;
		/**
		 * @var QLabel lblLastName
		 * @access protected
		 */
		protected $lblLastName;
		/**
		 * @var QLabel lblPhone
		 * @access protected
		 */
		protected $lblPhone;
		/**
		 * @var QLabel lblMobile
		 * @access protected
		 */
		protected $lblMobile;
		/**
		 * @var QLabel lblEmail
		 * @access protected
		 */
		protected $lblEmail;
		/**
		 * @var QLabel lblIsEnable
		 * @access protected
		 */
		protected $lblIsEnable;
		/**
		 * @var QLabel lblIsAdmin
		 * @access protected
		 */
		protected $lblIsAdmin;
		/**
		 * @var QLabel lblUsername
		 * @access protected
		 */
		protected $lblUsername;
		/**
		 * @var QLabel lblPassword
		 * @access protected
		 */
		protected $lblPassword;
		/**
		 * @var QLabel lblLogUser
		 * @access protected
		 */
		protected $lblLogUser;
		/**
		 * @var QLabel lblLogInsert
		 * @access protected
		 */
		protected $lblLogInsert;

		// QListBox Controls (if applicable) to edit Unique ReverseReferences and ManyToMany References

		// QLabel Controls (if applicable) to view Unique ReverseReferences and ManyToMany References


		/**
		 * Main constructor.  Constructor OR static create methods are designed to be called in either
		 * a parent QPanel or the main QForm when wanting to create a
		 * UserMetaControl to edit a single User object within the
		 * QPanel or QForm.
		 *
		 * This constructor takes in a single User object, while any of the static
		 * create methods below can be used to construct based off of individual PK ID(s).
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this UserMetaControl
		 * @param User $objUser new or existing User object
		 */
		 public function __construct($objParentObject, User $objUser) {
			// Setup Parent Object (e.g. QForm or QPanel which will be using this UserMetaControl)
			$this->objParentObject = $objParentObject;

			// Setup linked User object
			$this->objUser = $objUser;

			// Figure out if we're Editing or Creating New
			if ($this->objUser->__Restored) {
				$this->strTitleVerb = QApplication::Translate('Edit');
				$this->blnEditMode = true;
			} else {
				$this->strTitleVerb = QApplication::Translate('Create');
				$this->blnEditMode = false;
			}
		 }

		/**
		 * Static Helper Method to Create using PK arguments
		 * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
		 * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
		 * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to
		 * edit, or if we are also allowed to create a new one, etc.
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this UserMetaControl
		 * @param integer $intId primary key value
		 * @param QMetaControlCreateType $intCreateType rules governing User object creation - defaults to CreateOrEdit
 		 * @return UserMetaControl
		 */
		public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			// Attempt to Load from PK Arguments
			if (strlen($intId)) {
				$objUser = User::Load($intId);

				// User was found -- return it!
				if ($objUser)
					return new UserMetaControl($objParentObject, $objUser);

				// If CreateOnRecordNotFound not specified, throw an exception
				else if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound)
					throw new QCallerException('Could not find a User object with PK arguments: ' . $intId);

			// If EditOnly is specified, throw an exception
			} else if ($intCreateType == QMetaControlCreateType::EditOnly)
				throw new QCallerException('No PK arguments specified');

			// If we are here, then we need to create a new record
			return new UserMetaControl($objParentObject, new User());
		}

		/**
		 * Static Helper Method to Create using PathInfo arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this UserMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing User object creation - defaults to CreateOrEdit
		 * @return UserMetaControl
		 */
		public static function CreateFromPathInfo($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::PathInfo(0);
			return UserMetaControl::Create($objParentObject, $intId, $intCreateType);
		}

		/**
		 * Static Helper Method to Create using QueryString arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this UserMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing User object creation - defaults to CreateOrEdit
		 * @return UserMetaControl
		 */
		public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::QueryString('intId');
			return UserMetaControl::Create($objParentObject, $intId, $intCreateType);
		}



		///////////////////////////////////////////////
		// PUBLIC CREATE and REFRESH METHODS
		///////////////////////////////////////////////

		/**
		 * Create and setup QLabel lblId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblId_Create($strControlId = null) {
			$this->lblId = new QLabel($this->objParentObject, $strControlId);
			$this->lblId->Name = QApplication::Translate('Id');
			if ($this->blnEditMode)
				$this->lblId->Text = $this->objUser->Id;
			else
				$this->lblId->Text = 'N/A';
			return $this->lblId;
		}

		/**
		 * Create and setup QTextBox txtFirstName
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtFirstName_Create($strControlId = null) {
			$this->txtFirstName = new QTextBox($this->objParentObject, $strControlId);
			$this->txtFirstName->Name = QApplication::Translate('First Name');
			$this->txtFirstName->Text = $this->objUser->FirstName;
			$this->txtFirstName->Required = true;
			$this->txtFirstName->MaxLength = User::FirstNameMaxLength;
			return $this->txtFirstName;
		}

		/**
		 * Create and setup QLabel lblFirstName
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblFirstName_Create($strControlId = null) {
			$this->lblFirstName = new QLabel($this->objParentObject, $strControlId);
			$this->lblFirstName->Name = QApplication::Translate('First Name');
			$this->lblFirstName->Text = $this->objUser->FirstName;
			$this->lblFirstName->Required = true;
			return $this->lblFirstName;
		}

		/**
		 * Create and setup QTextBox txtLastName
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtLastName_Create($strControlId = null) {
			$this->txtLastName = new QTextBox($this->objParentObject, $strControlId);
			$this->txtLastName->Name = QApplication::Translate('Last Name');
			$this->txtLastName->Text = $this->objUser->LastName;
			$this->txtLastName->Required = true;
			$this->txtLastName->MaxLength = User::LastNameMaxLength;
			return $this->txtLastName;
		}

		/**
		 * Create and setup QLabel lblLastName
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblLastName_Create($strControlId = null) {
			$this->lblLastName = new QLabel($this->objParentObject, $strControlId);
			$this->lblLastName->Name = QApplication::Translate('Last Name');
			$this->lblLastName->Text = $this->objUser->LastName;
			$this->lblLastName->Required = true;
			return $this->lblLastName;
		}

		/**
		 * Create and setup QTextBox txtPhone
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtPhone_Create($strControlId = null) {
			$this->txtPhone = new QTextBox($this->objParentObject, $strControlId);
			$this->txtPhone->Name = QApplication::Translate('Phone');
			$this->txtPhone->Text = $this->objUser->Phone;
			$this->txtPhone->MaxLength = User::PhoneMaxLength;
			return $this->txtPhone;
		}

		/**
		 * Create and setup QLabel lblPhone
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblPhone_Create($strControlId = null) {
			$this->lblPhone = new QLabel($this->objParentObject, $strControlId);
			$this->lblPhone->Name = QApplication::Translate('Phone');
			$this->lblPhone->Text = $this->objUser->Phone;
			return $this->lblPhone;
		}

		/**
		 * Create and setup QTextBox txtMobile
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtMobile_Create($strControlId = null) {
			$this->txtMobile = new QTextBox($this->objParentObject, $strControlId);
			$this->txtMobile->Name = QApplication::Translate('Mobile');
			$this->txtMobile->Text = $this->objUser->Mobile;
			$this->txtMobile->MaxLength = User::MobileMaxLength;
			return $this->txtMobile;
		}

		/**
		 * Create and setup QLabel lblMobile
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblMobile_Create($strControlId = null) {
			$this->lblMobile = new QLabel($this->objParentObject, $strControlId);
			$this->lblMobile->Name = QApplication::Translate('Mobile');
			$this->lblMobile->Text = $this->objUser->Mobile;
			return $this->lblMobile;
		}

		/**
		 * Create and setup QTextBox txtEmail
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtEmail_Create($strControlId = null) {
			$this->txtEmail = new QTextBox($this->objParentObject, $strControlId);
			$this->txtEmail->Name = QApplication::Translate('Email');
			$this->txtEmail->Text = $this->objUser->Email;
			$this->txtEmail->MaxLength = User::EmailMaxLength;
			return $this->txtEmail;
		}

		/**
		 * Create and setup QLabel lblEmail
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblEmail_Create($strControlId = null) {
			$this->lblEmail = new QLabel($this->objParentObject, $strControlId);
			$this->lblEmail->Name = QApplication::Translate('Email');
			$this->lblEmail->Text = $this->objUser->Email;
			return $this->lblEmail;
		}

		/**
		 * Create and setup QCheckBox chkIsEnable
		 * @param string $strControlId optional ControlId to use
		 * @return QCheckBox
		 */
		public function chkIsEnable_Create($strControlId = null) {
			$this->chkIsEnable = new QCheckBox($this->objParentObject, $strControlId);
			$this->chkIsEnable->Name = QApplication::Translate('Is Enable');
			$this->chkIsEnable->Checked = $this->objUser->IsEnable;
			return $this->chkIsEnable;
		}

		/**
		 * Create and setup QLabel lblIsEnable
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblIsEnable_Create($strControlId = null) {
			$this->lblIsEnable = new QLabel($this->objParentObject, $strControlId);
			$this->lblIsEnable->Name = QApplication::Translate('Is Enable');
			$this->lblIsEnable->Text = ($this->objUser->IsEnable) ? QApplication::Translate('Yes') : QApplication::Translate('No');
			return $this->lblIsEnable;
		}

		/**
		 * Create and setup QCheckBox chkIsAdmin
		 * @param string $strControlId optional ControlId to use
		 * @return QCheckBox
		 */
		public function chkIsAdmin_Create($strControlId = null) {
			$this->chkIsAdmin = new QCheckBox($this->objParentObject, $strControlId);
			$this->chkIsAdmin->Name = QApplication::Translate('Is Admin');
			$this->chkIsAdmin->Checked = $this->objUser->IsAdmin;
			return $this->chkIsAdmin;
		}

		/**
		 * Create and setup QLabel lblIsAdmin
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblIsAdmin_Create($strControlId = null) {
			$this->lblIsAdmin = new QLabel($this->objParentObject, $strControlId);
			$this->lblIsAdmin->Name = QApplication::Translate('Is Admin');
			$this->lblIsAdmin->Text = ($this->objUser->IsAdmin) ? QApplication::Translate('Yes') : QApplication::Translate('No');
			return $this->lblIsAdmin;
		}

		/**
		 * Create and setup QTextBox txtUsername
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtUsername_Create($strControlId = null) {
			$this->txtUsername = new QTextBox($this->objParentObject, $strControlId);
			$this->txtUsername->Name = QApplication::Translate('Username');
			$this->txtUsername->Text = $this->objUser->Username;
			$this->txtUsername->Required = true;
			$this->txtUsername->MaxLength = User::UsernameMaxLength;
			return $this->txtUsername;
		}

		/**
		 * Create and setup QLabel lblUsername
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblUsername_Create($strControlId = null) {
			$this->lblUsername = new QLabel($this->objParentObject, $strControlId);
			$this->lblUsername->Name = QApplication::Translate('Username');
			$this->lblUsername->Text = $this->objUser->Username;
			$this->lblUsername->Required = true;
			return $this->lblUsername;
		}

		/**
		 * Create and setup QTextBox txtPassword
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtPassword_Create($strControlId = null) {
			$this->txtPassword = new QTextBox($this->objParentObject, $strControlId);
			$this->txtPassword->Name = QApplication::Translate('Password');
			$this->txtPassword->Text = $this->objUser->Password;
			$this->txtPassword->Required = true;
			$this->txtPassword->MaxLength = User::PasswordMaxLength;
			return $this->txtPassword;
		}

		/**
		 * Create and setup QLabel lblPassword
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblPassword_Create($strControlId = null) {
			$this->lblPassword = new QLabel($this->objParentObject, $strControlId);
			$this->lblPassword->Name = QApplication::Translate('Password');
			$this->lblPassword->Text = $this->objUser->Password;
			$this->lblPassword->Required = true;
			return $this->lblPassword;
		}

		/**
		 * Create and setup QTextBox txtLogUser
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtLogUser_Create($strControlId = null) {
			$this->txtLogUser = new QTextBox($this->objParentObject, $strControlId);
			$this->txtLogUser->Name = QApplication::Translate('Log User');
			$this->txtLogUser->Text = $this->objUser->LogUser;
			$this->txtLogUser->MaxLength = User::LogUserMaxLength;
			return $this->txtLogUser;
		}

		/**
		 * Create and setup QLabel lblLogUser
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblLogUser_Create($strControlId = null) {
			$this->lblLogUser = new QLabel($this->objParentObject, $strControlId);
			$this->lblLogUser->Name = QApplication::Translate('Log User');
			$this->lblLogUser->Text = $this->objUser->LogUser;
			return $this->lblLogUser;
		}

		/**
		 * Create and setup QDateTimePicker calLogInsert
		 * @param string $strControlId optional ControlId to use
		 * @return QDateTimePicker
		 */
		public function calLogInsert_Create($strControlId = null) {
			$this->calLogInsert = new QDateTimePicker($this->objParentObject, $strControlId);
			$this->calLogInsert->Name = QApplication::Translate('Log Insert');
			$this->calLogInsert->DateTime = $this->objUser->LogInsert;
			$this->calLogInsert->DateTimePickerType = QDateTimePickerType::DateTime;
			return $this->calLogInsert;
		}

		/**
		 * Create and setup QLabel lblLogInsert
		 * @param string $strControlId optional ControlId to use
		 * @param string $strDateTimeFormat optional DateTimeFormat to use
		 * @return QLabel
		 */
		public function lblLogInsert_Create($strControlId = null, $strDateTimeFormat = null) {
			$this->lblLogInsert = new QLabel($this->objParentObject, $strControlId);
			$this->lblLogInsert->Name = QApplication::Translate('Log Insert');
			$this->strLogInsertDateTimeFormat = $strDateTimeFormat;
			$this->lblLogInsert->Text = sprintf($this->objUser->LogInsert) ? $this->objUser->LogInsert->qFormat($this->strLogInsertDateTimeFormat) : null;
			return $this->lblLogInsert;
		}

		protected $strLogInsertDateTimeFormat;


		/**
		 * Create and setup QLabel lblLogUpdate
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblLogUpdate_Create($strControlId = null) {
			$this->lblLogUpdate = new QLabel($this->objParentObject, $strControlId);
			$this->lblLogUpdate->Name = QApplication::Translate('Log Update');
			if ($this->blnEditMode)
				$this->lblLogUpdate->Text = $this->objUser->LogUpdate;
			else
				$this->lblLogUpdate->Text = 'N/A';
			return $this->lblLogUpdate;
		}



		/**
		 * Refresh this MetaControl with Data from the local User object.
		 * @param boolean $blnReload reload User from the database
		 * @return void
		 */
		public function Refresh($blnReload = false) {
			if ($blnReload)
				$this->objUser->Reload();

			if ($this->lblId) if ($this->blnEditMode) $this->lblId->Text = $this->objUser->Id;

			if ($this->txtFirstName) $this->txtFirstName->Text = $this->objUser->FirstName;
			if ($this->lblFirstName) $this->lblFirstName->Text = $this->objUser->FirstName;

			if ($this->txtLastName) $this->txtLastName->Text = $this->objUser->LastName;
			if ($this->lblLastName) $this->lblLastName->Text = $this->objUser->LastName;

			if ($this->txtPhone) $this->txtPhone->Text = $this->objUser->Phone;
			if ($this->lblPhone) $this->lblPhone->Text = $this->objUser->Phone;

			if ($this->txtMobile) $this->txtMobile->Text = $this->objUser->Mobile;
			if ($this->lblMobile) $this->lblMobile->Text = $this->objUser->Mobile;

			if ($this->txtEmail) $this->txtEmail->Text = $this->objUser->Email;
			if ($this->lblEmail) $this->lblEmail->Text = $this->objUser->Email;

			if ($this->chkIsEnable) $this->chkIsEnable->Checked = $this->objUser->IsEnable;
			if ($this->lblIsEnable) $this->lblIsEnable->Text = ($this->objUser->IsEnable) ? QApplication::Translate('Yes') : QApplication::Translate('No');

			if ($this->chkIsAdmin) $this->chkIsAdmin->Checked = $this->objUser->IsAdmin;
			if ($this->lblIsAdmin) $this->lblIsAdmin->Text = ($this->objUser->IsAdmin) ? QApplication::Translate('Yes') : QApplication::Translate('No');

			if ($this->txtUsername) $this->txtUsername->Text = $this->objUser->Username;
			if ($this->lblUsername) $this->lblUsername->Text = $this->objUser->Username;

			if ($this->txtPassword) $this->txtPassword->Text = $this->objUser->Password;
			if ($this->lblPassword) $this->lblPassword->Text = $this->objUser->Password;

			if ($this->txtLogUser) $this->txtLogUser->Text = $this->objUser->LogUser;
			if ($this->lblLogUser) $this->lblLogUser->Text = $this->objUser->LogUser;

			if ($this->calLogInsert) $this->calLogInsert->DateTime = $this->objUser->LogInsert;
			if ($this->lblLogInsert) $this->lblLogInsert->Text = sprintf($this->objUser->LogInsert) ? $this->objUser->LogInsert->qFormat($this->strLogInsertDateTimeFormat) : null;

			if ($this->lblLogUpdate) if ($this->blnEditMode) $this->lblLogUpdate->Text = $this->objUser->LogUpdate;

		}



		///////////////////////////////////////////////
		// PROTECTED UPDATE METHODS for ManyToManyReferences (if any)
		///////////////////////////////////////////////





		///////////////////////////////////////////////
		// PUBLIC USER OBJECT MANIPULATORS
		///////////////////////////////////////////////

		/**
		 * This will save this object's User instance,
		 * updating only the fields which have had a control created for it.
		 */
		public function SaveUser() {
			try {
				// Update any fields for controls that have been created
				if ($this->txtFirstName) $this->objUser->FirstName = $this->txtFirstName->Text;
				if ($this->txtLastName) $this->objUser->LastName = $this->txtLastName->Text;
				if ($this->txtPhone) $this->objUser->Phone = $this->txtPhone->Text;
				if ($this->txtMobile) $this->objUser->Mobile = $this->txtMobile->Text;
				if ($this->txtEmail) $this->objUser->Email = $this->txtEmail->Text;
				if ($this->chkIsEnable) $this->objUser->IsEnable = $this->chkIsEnable->Checked;
				if ($this->chkIsAdmin) $this->objUser->IsAdmin = $this->chkIsAdmin->Checked;
				if ($this->txtUsername) $this->objUser->Username = $this->txtUsername->Text;
				if ($this->txtPassword) $this->objUser->Password = $this->txtPassword->Text;
				if ($this->txtLogUser) $this->objUser->LogUser = $this->txtLogUser->Text;
				if ($this->calLogInsert) $this->objUser->LogInsert = $this->calLogInsert->DateTime;

				// Update any UniqueReverseReferences (if any) for controls that have been created for it

				// Save the User object
				$this->objUser->Save();

				// Finally, update any ManyToManyReferences (if any)
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * This will DELETE this object's User instance from the database.
		 * It will also unassociate itself from any ManyToManyReferences.
		 */
		public function DeleteUser() {
			$this->objUser->Delete();
		}



		///////////////////////////////////////////////
		// PUBLIC GETTERS and SETTERS
		///////////////////////////////////////////////

		/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				// General MetaControlVariables
				case 'User': return $this->objUser;
				case 'TitleVerb': return $this->strTitleVerb;
				case 'EditMode': return $this->blnEditMode;

				// Controls that point to User fields -- will be created dynamically if not yet created
				case 'IdControl':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'IdLabel':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'FirstNameControl':
					if (!$this->txtFirstName) return $this->txtFirstName_Create();
					return $this->txtFirstName;
				case 'FirstNameLabel':
					if (!$this->lblFirstName) return $this->lblFirstName_Create();
					return $this->lblFirstName;
				case 'LastNameControl':
					if (!$this->txtLastName) return $this->txtLastName_Create();
					return $this->txtLastName;
				case 'LastNameLabel':
					if (!$this->lblLastName) return $this->lblLastName_Create();
					return $this->lblLastName;
				case 'PhoneControl':
					if (!$this->txtPhone) return $this->txtPhone_Create();
					return $this->txtPhone;
				case 'PhoneLabel':
					if (!$this->lblPhone) return $this->lblPhone_Create();
					return $this->lblPhone;
				case 'MobileControl':
					if (!$this->txtMobile) return $this->txtMobile_Create();
					return $this->txtMobile;
				case 'MobileLabel':
					if (!$this->lblMobile) return $this->lblMobile_Create();
					return $this->lblMobile;
				case 'EmailControl':
					if (!$this->txtEmail) return $this->txtEmail_Create();
					return $this->txtEmail;
				case 'EmailLabel':
					if (!$this->lblEmail) return $this->lblEmail_Create();
					return $this->lblEmail;
				case 'IsEnableControl':
					if (!$this->chkIsEnable) return $this->chkIsEnable_Create();
					return $this->chkIsEnable;
				case 'IsEnableLabel':
					if (!$this->lblIsEnable) return $this->lblIsEnable_Create();
					return $this->lblIsEnable;
				case 'IsAdminControl':
					if (!$this->chkIsAdmin) return $this->chkIsAdmin_Create();
					return $this->chkIsAdmin;
				case 'IsAdminLabel':
					if (!$this->lblIsAdmin) return $this->lblIsAdmin_Create();
					return $this->lblIsAdmin;
				case 'UsernameControl':
					if (!$this->txtUsername) return $this->txtUsername_Create();
					return $this->txtUsername;
				case 'UsernameLabel':
					if (!$this->lblUsername) return $this->lblUsername_Create();
					return $this->lblUsername;
				case 'PasswordControl':
					if (!$this->txtPassword) return $this->txtPassword_Create();
					return $this->txtPassword;
				case 'PasswordLabel':
					if (!$this->lblPassword) return $this->lblPassword_Create();
					return $this->lblPassword;
				case 'LogUserControl':
					if (!$this->txtLogUser) return $this->txtLogUser_Create();
					return $this->txtLogUser;
				case 'LogUserLabel':
					if (!$this->lblLogUser) return $this->lblLogUser_Create();
					return $this->lblLogUser;
				case 'LogInsertControl':
					if (!$this->calLogInsert) return $this->calLogInsert_Create();
					return $this->calLogInsert;
				case 'LogInsertLabel':
					if (!$this->lblLogInsert) return $this->lblLogInsert_Create();
					return $this->lblLogInsert;
				case 'LogUpdateControl':
					if (!$this->lblLogUpdate) return $this->lblLogUpdate_Create();
					return $this->lblLogUpdate;
				case 'LogUpdateLabel':
					if (!$this->lblLogUpdate) return $this->lblLogUpdate_Create();
					return $this->lblLogUpdate;
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			try {
				switch ($strName) {
					// Controls that point to User fields
					case 'IdControl':
						return ($this->lblId = QType::Cast($mixValue, 'QControl'));
					case 'FirstNameControl':
						return ($this->txtFirstName = QType::Cast($mixValue, 'QControl'));
					case 'LastNameControl':
						return ($this->txtLastName = QType::Cast($mixValue, 'QControl'));
					case 'PhoneControl':
						return ($this->txtPhone = QType::Cast($mixValue, 'QControl'));
					case 'MobileControl':
						return ($this->txtMobile = QType::Cast($mixValue, 'QControl'));
					case 'EmailControl':
						return ($this->txtEmail = QType::Cast($mixValue, 'QControl'));
					case 'IsEnableControl':
						return ($this->chkIsEnable = QType::Cast($mixValue, 'QControl'));
					case 'IsAdminControl':
						return ($this->chkIsAdmin = QType::Cast($mixValue, 'QControl'));
					case 'UsernameControl':
						return ($this->txtUsername = QType::Cast($mixValue, 'QControl'));
					case 'PasswordControl':
						return ($this->txtPassword = QType::Cast($mixValue, 'QControl'));
					case 'LogUserControl':
						return ($this->txtLogUser = QType::Cast($mixValue, 'QControl'));
					case 'LogInsertControl':
						return ($this->calLogInsert = QType::Cast($mixValue, 'QControl'));
					case 'LogUpdateControl':
						return ($this->lblLogUpdate = QType::Cast($mixValue, 'QControl'));
					default:
						return parent::__set($strName, $mixValue);
				}
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}
	}
?>